/*
 * @Author: LiZn
 * @Date: 2021-08-20 00:14:47
 * @LastEditTime: 2021-08-22 10:01:38
 * @LastEditors: LiZn
 * @Description: file content
 * @FilePath: \todaynews\src\router\index.js
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

export const staticRoutes = [
  {
    path: '/',
    redirect:'/index',
    component:Home,
    meta:{
      keepAlive:true
    }
  },
  {
    path:"/index",
    name:"Home",
    component:Home,
    meta:{
      keepAlive:true
    }
  },
  {
    path: '/xigua',
    name: 'xigua',
    component: () => import(/* webpackChunkName: "about" */ '../views/Xigua.vue'),
    meta:{
      keepAlive:true
    }
  },
  {
    path:'/content/:id',
    name:"content",
    component:()=>import(/* webpackChunkName: 'content'*/ '@/views/listcontent'),
    children:[
      {
        path:'cont',
        component:()=>import(/* webpackChunkName: 'content'*/ '@/views/cont')
      }
    ]
  },
  {
    path: '/videos',
    name: 'video',
    component:()=>import(/* webpackChunkName: 'videos'*/ '@/views/Videos'),
    meta:{
      keepAlive:true
    }
  },
  {
    path: '/my',
    name: 'my',
    component: () => import(/* webpackChunkName: "my" */ '@/views/My'),
    meta:{
      keepAlive:true
    },
    children:[]
  }
]
export const asyncRoutes = [
  {
    path:'/userset',
    name:'userset',
    component:()=>import(/* webpackChunkName: 'my'*/ '@/views/userSet'),
    meta:{
      roles:['admin']
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes:staticRoutes
})

export default router
